package com.leetcode.LC;

import java.util.Arrays;

public class LC1752 {
    public boolean check(int[] nums) {
        //拼接一个数组，再去判断拼接的数组是否包含源数组
        StringBuilder builder = new StringBuilder();
        for (int num : nums) {
            builder.append(num);
            builder.append(",");
        }
        String s = builder.toString();
        Arrays.sort(nums);
        StringBuilder builder2 = new StringBuilder();
        for (int num : nums) {
            builder2.append(num);
            builder2.append(",");
        }
        return builder.append(s).toString().contains(builder2.toString());
    }

    public static void main(String[] args) {
        System.out.println(new LC1752().check(new int[]{11, 11, 1, 20}));
    }
}
